package res

type res struct {
	Code int			`json:"code"`
	Content interface{}	`json:"content"`
	Msg string			`json:"msg"`
}

const (
	SUCCESS = 0
	FAILED	= -1
	UNAUTH	= 4001
)

func Response(code int,data interface{}, msg string) (int, *res) {
	return 200, &res{code, data, msg}
}

func SuccessJson(data interface{}) (int, *res) {
	return 200, &res{SUCCESS, data, "成功"}
}

func FailedJson(msg string) (int, *res) {
	return 200, &res{FAILED, nil, msg}
}
